{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## SVM中的使用多项式特征"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from sklearn import datasets\n",
    "\n",
    "X, y = datasets.make_moons()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(100, 2)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(100,)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAD8CAYAAAB+UHOxAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHQVJREFUeJzt3X+wHeV93/H3h8vFvQ5UAnND4EqK1I5iSgAXcwMe4+lA\nsLFQQ0VxS7E7ieNJR6M2ND/aJijNDKHpeJDrmdhm7ITREKYwsa0wgWLZwcUG7LptiotkfiMDKrGN\nLrKRASn+oRgJvv3jnIOOzt299x6dPbvP7n5eM3d0fqzO7p59nv2efZ7v86wiAjMza5/jqt4AMzOr\nhgOAmVlLOQCYmbWUA4CZWUs5AJiZtZQDgJlZSzkAmJm1lAOAmVlLOQCYmbXU8VVvwEJOPfXUWL16\nddWbYWZWGzt37vx+REwvZdmkA8Dq1avZsWNH1ZthZlYbkr691GXdBGRm1lI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OWc/PgvsBQ5168ev1fR4LLYfdTke76LTf/cY8Ej3b30Vx8Qjgc3MWqqNTUBmZoYDgJlZ\nazkAmJm1lAOAmVlLOQCYmbWUA4CZWUs5AJiZtZQDgJlZS/1/tWL1+ej1vqIAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x110859c88>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(X[y==0,0], X[y==0,1])\n",
    "plt.scatter(X[y==1,0], X[y==1,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAAD8CAYAAABzTgP2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X2wXHWd5/H3hxB276KViGAMN7kbrEoxwyhPcwsppVYR\n5GnKTZzZpUBXqV2tLLXjOLpTlJl1i6VwpyY7luMuOygTGUqcGqEyJWDUKAPRKWZxcUkEAghIBCxy\njcSnREZSQ4jf/aPPhe5OP5zuPn3O73R/XlW3bvd5yP1x6D7f38P39zuKCMzMzBYdVXUBzMwsLQ4M\nZmbWwoHBzMxaODCYmVkLBwYzM2vhwGBmZi0cGMzMrIUDg5mZtXBgMDOzFkdXXYBhHH/88bFmzZqq\ni2FmVis7d+78aUSc0O+4WgaGNWvWsGPHjqqLYWZWK5J+mOc4dyWZmVkLBwYzM2vhwGBmZi0cGMzM\nrEUhgUHSTZL2SXqky/73Stol6WFJ35Z0WtO+Z7LtD0ryiLKZWcWKajF8Hriox/6ngbdFxJuATwCb\n2/afGxGnR8R8QeUxM7MhFZKuGhH3SFrTY/+3m97eB6wq4u+amVnxqpjH8AHg603vA7hb0mHgLyOi\nvTVhNXHHAwt88s4n+NH+g5y4fIarLjyZ9WfMVl0sMxtQqYFB0rk0AsM5TZvPiYgFSa8D7pL0eETc\n0+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lvAfYCh7LP7gcSv7b9ypvMtc3Kcw6N\nMbpdwIPZzyUpX+O8P575bGZmLdyVZGZmLRwYzMyshQODmZm1cGAwM7MWDgxmZtbCgcHMzFo4MJiZ\nWQsHBjMza/H/AUTAjc/C5ZbKAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x11084f940>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "X, y = datasets.make_moons(noise=0.15, random_state=666)\n",
    "\n",
    "plt.scatter(X[y==0,0], X[y==0,1])\n",
    "plt.scatter(X[y==1,0], X[y==1,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 使用多项式特征的SVM"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from sklearn.preprocessing import PolynomialFeatures, StandardScaler\n",
    "from sklearn.svm import LinearSVC\n",
    "from sklearn.pipeline import Pipeline\n",
    "\n",
    "def PolynomialSVC(degree, C=1.0):\n",
    "    return Pipeline([\n",
    "        (\"poly\", PolynomialFeatures(degree=degree)),\n",
    "        (\"std_scaler\", StandardScaler()),\n",
    "        (\"linearSVC\", LinearSVC(C=C))\n",
    "    ])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Pipeline(steps=[('poly', PolynomialFeatures(degree=3, include_bias=True, interaction_only=False)), ('std_scaler', StandardScaler(copy=True, with_mean=True, with_std=True)), ('linearSVC', LinearSVC(C=1.0, class_weight=None, dual=True, fit_intercept=True,\n",
       "     intercept_scaling=1, loss='squared_hinge', max_iter=1000,\n",
       "     multi_class='ovr', penalty='l2', random_state=None, tol=0.0001,\n",
       "     verbose=0))])"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "poly_svc = PolynomialSVC(degree=3)\n",
    "poly_svc.fit(X, y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def plot_decision_boundary(model, axis):\n",
    "    \n",
    "    x0, x1 = np.meshgrid(\n",
    "        np.linspace(axis[0], axis[1], int((axis[1]-axis[0])*100)).reshape(-1, 1),\n",
    "        np.linspace(axis[2], axis[3], int((axis[3]-axis[2])*100)).reshape(-1, 1),\n",
    "    )\n",
    "    X_new = np.c_[x0.ravel(), x1.ravel()]\n",
    "\n",
    "    y_predict = model.predict(X_new)\n",
    "    zz = y_predict.reshape(x0.shape)\n",
    "\n",
    "    from matplotlib.colors import ListedColormap\n",
    "    custom_cmap = ListedColormap(['#EF9A9A','#FFF59D','#90CAF9'])\n",
    "    \n",
    "    plt.contourf(x0, x1, zz, linewidth=5, cmap=custom_cmap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAD8CAYAAAB3u9PLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAH8ZJREFUeJzt3X+MVeWZB/Dvw51ZmdrRkSIyDv7oDyCVuh2U0K6Yruti\nI7gJ7YZttJDOmmaJjVoas0lN2dikiYm7m5igtjXE1WJ02zRsa80K60ptY5fERgUURgpFt1amo+OP\nBaY61Jnh2T/uuXjnes6959z7nvd9z3u+n4Rw585lzsuZe89z3vd93ucVVQUREdEs1w0gIiI/MCAQ\nEREABgQiIoowIBAREQAGBCIiijAgEBERAEMBQUTuF5ExEdmf8P0rROSYiOyN/txm4rhERGROl6Gf\n8wMA9wB4sMlrfqWqf2PoeEREZJiRHoKqPgXgbRM/i4iI3DDVQ0jjMhF5AcAIgH9U1eG4F4nIBgAb\nAOD00067dOH8+RabSEQ2vdXzEddNCM6rv9n9pqqe3c6/tRUQdgM4X1X/KCKrATwCYGHcC1V1C4At\nAL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kuhxL4BDnr4307Qz8/n0poegqgdU9aDr\ndrSSsp2nynWo6nsAauU6bFoDYGv0eCuAL1g+fjNpzs8aAA9q1dMA+kSk38N2OqeqTwF4u8lLfDiX\nadrpnKqOquru6PE4qpmRAw0vc34+U7YzM28CQgYKYKeIPBeVufBRXLmOjn9ZGZ2jqqPR49cAnJPw\nOhfnM8358eEcpm3DZdHQwQ4RWWKnaZn4cC7T8uZcisiFAJYC+HXDt7w6n03aCWQ8nzZqGZ1iqAzG\n5ao6IiLzADwhIr+J7jyMsV2uo13N2ln/haqqiCTlF+d+PgO3G8D5qvpHEVkN4BEACx23qai8OZci\n8mEA/wHgG6p63EUb0mjRzszn02pA0M7LYEBVR6K/x0Tkp6h2641ewAy000q5jmbtFJHXRaRfVUej\n7uxYws/I/XzGSHN+fCh50rIN9R9CVd0uIt8Tkbmq6lMBNB/OZUu+nEsR6Ub1Ivuwqv4k5iVenM9W\n7WznfBZqyEhETheR3tpjAJ9HdU8G3/hQruNRAEPR4yEAH+jZODyfac7PowC+EmV0fBbAsbohMFta\ntlNE5otU67+LyHJUP1NvWW5nKz6cy5Z8OJfR8f8NwAFVvTPhZc7PZ5p2tnU+bc+ON5k1/yKqY3F/\nAvA6gMej588FsD16/DFUMz2eBzCM6hCOd+3U9zMRDqGapeKinR8B8HMAvwWwE8Acn85n3PkBcAOA\nG6LHgurGSi8B2IcmmWeO23lTdO6eB/A0gMsctPGHAEYBTEbvza96ei5btdOHc3k5qvNqLwDYG/1Z\n7dv5TNnOzOeTpSuIiAhAwYaMiIgoPwwIREQEgAGBiIgiDAhERASAAYGIiCIMCEREBIABgYiIIv8P\nVZnx8wuOI+sAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1143bdf98>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_boundary(poly_svc, axis=[-1.5, 2.5, -1.0, 1.5])\n",
    "plt.scatter(X[y==0,0], X[y==0,1])\n",
    "plt.scatter(X[y==1,0], X[y==1,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 使用多项式核函数的SVM"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from sklearn.svm import SVC\n",
    "\n",
    "def PolynomialKernelSVC(degree, C=1.0):\n",
    "    return Pipeline([\n",
    "        (\"std_scaler\", StandardScaler()),\n",
    "        (\"kernelSVC\", SVC(kernel=\"poly\", degree=degree, C=C))\n",
    "    ])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Pipeline(steps=[('std_scaler', StandardScaler(copy=True, with_mean=True, with_std=True)), ('kernelSVC', SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,\n",
       "  decision_function_shape=None, degree=3, gamma='auto', kernel='poly',\n",
       "  max_iter=-1, probability=False, random_state=None, shrinking=True,\n",
       "  tol=0.001, verbose=False))])"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "poly_kernel_svc = PolynomialKernelSVC(degree=3)\n",
    "poly_kernel_svc.fit(X, y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAD8CAYAAAB3u9PLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHrpJREFUeJzt3X+MXfWZ3/H34xknnmUHjBccJjbEyfJDYaGLAZFtHCKa\nkih2KtFtaUWWqgjtymIVSNOoUlEtsVKkqNv+wSpAdpFFkwWpTRSRDUGNKcIhK1KkrMKvgI0LMTQm\ndicxP4Q9WcaLx376xz13uHN97r3n3Ps953zPOZ+XZHnm3jtzvj6+9zzfH8/3OebuiIiIrKq6ASIi\nEgcFBBERARQQRE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g5OLDbzJ5O\nylzEKK1cx8T/WTl9wN3nk69/BXxgwOuqOJ9Zzk8M5zBrGz6eTB08Yma/V07TconhXGYVzbk0s03A\nZuDv+p6K6nwOaSfkPJ9l1DJaFqgMxifc/ZCZrQceM7P/k/Q8gim7XMe4hrWz9xt3dzMblF9c+Pls\nuGeA89z9N2a2DXgIuKDiNtVVNOfSzH4b+C7wJXc/WkUbshjRztzns9SA4JOXwcDdDyV/Hzaz79EZ\n1ge9gAVoZynlOoa108x+bWZz7j6fDGcPD/gdhZ/PFFnOTwwlT0a2ofdD6O67zOwvzewsd4+pAFoM\n53KkWM6lma2mc5H97+7+NykvieJ8jmrnOOezVlNGZnaamc12vwY+Q+eeDLGJoVzHw8BNydc3AaeM\nbCo8n1nOz8PAv00yOv4AONIzBVaWke00s3PMOvXfzewqOp+pN0tu5ygxnMuRYjiXyfH/G7DP3e8c\n8LLKz2eWdo51PsteHR+yav6HdObi/gH4NfBo8vgHgV3J1x+hk+nxM2AvnSmc6Nrp72UivEwnS6WK\ndv4O8EPg58BuYF1M5zPt/AC3ALckXxudGyu9ArzAkMyzitt5a3Lufgb8BPh4BW38FjAPHE/em38c\n6bkc1c4YzuUn6KyrPQ88l/zZFtv5zNjO3OdTpStERASo2ZSRiIgURwFBREQABQQREUkoIIiICKCA\nICIiCQUEEREBFBBERCTx/wHzEckqkRk1mQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1143e0208>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_boundary(poly_kernel_svc, axis=[-1.5, 2.5, -1.0, 1.5])\n",
    "plt.scatter(X[y==0,0], X[y==0,1])\n",
    "plt.scatter(X[y==1,0], X[y==1,1])\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
